﻿using System;
using System.Collections.Generic;
using System.Text;
using Hoo.Windows.Shell.Properties;
using System.Diagnostics;
using Hoo.Windows.Shell.Util;

namespace Hoo.Windows.Shell.Menu {

    /// <summary>
    /// Defines a "DOS Here" menu. 
    /// When user clicks this menu, a DOS dialog will be opened under current directory. 
    /// </summary>
    public class CommandHereMenu : MenuItem {
        public CommandHereMenu()
            : base() {
            Title = "DOS Here";
            IconBitmap = Resources.imageDos;
        }

        public CommandHereMenu(int id)
            : this() {
            ID = id;
        }

        public override void Execute(string currentDirectory, IList<string> selectedFiles) {
            Process p = new Process();
            Logger.Info("DOS command working directory: " + currentDirectory);
            p.StartInfo.FileName = "cmd.exe";
            p.StartInfo.Arguments = "/k pushd " + currentDirectory;
            p.Start();
        }
        
    }
}
